package com.zoe.wan.android.example.repository.data

import android.os.Parcel
import android.os.Parcelable


/**
 *  banner实体
 */
class HomeBannerData : ArrayList<HomeBannerItemData>()


data class HomeBannerItemData(
    val desc: String?,
    val id: Int?,
    val imagePath: String?,
    val isVisible: Int?,
    val order: Int?,
    val title: String?,
    val type: Int?,
    val url: String?
) : Parcelable {
    constructor(parcel: Parcel) : this(
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString()
    ) {
    }

    override fun describeContents(): Int {
        return 0
    }

    override fun writeToParcel(p0: Parcel, p1: Int) {
        p0.writeString(desc)
        p0.writeValue(id)
        p0.writeString(imagePath)
        p0.writeValue(isVisible)
        p0.writeValue(order)
        p0.writeString(title)
        p0.writeValue(type)
        p0.writeString(url)
    }

    companion object CREATOR : Parcelable.Creator<HomeBannerItemData> {
        override fun createFromParcel(parcel: Parcel): HomeBannerItemData {
            return HomeBannerItemData(parcel)
        }

        override fun newArray(size: Int): Array<HomeBannerItemData?> {
            return arrayOfNulls(size)
        }
    }
}